using System;

namespace Microsoft.PowerShell.CmdletManagement
{
    /// <summary>
    /// A class that represents a noun
    /// </summary>
    public class PsSpecNoun : ICloneable, IEquatable<PsSpecNoun>, IComparable
    {
        public PsSpecNoun() { }

        public PsSpecNoun(int id, string name, string definition, string projectName)
        {
            this.id = id;
            this.name = name;
            this.definition = definition;
            this.project = projectName;
        }

        public int Id
        {
            get { return id; }
            set { id = value; }
        }
        private int id;

        public string Name
        {
            get { return name; }
            set { name = value; }
        }
        private string name;

        public string Definition
        {
            get { return definition; }
            set { definition = value; }
        }
        private string definition;

        public string ProjectName
        {
            get { return project; }
            set { project = value; }
        }
        private string project;

        public Object Clone()
        {
            return this.MemberwiseClone();
        }

        #region IEquatable<Noun> Members

        public bool Equals(PsSpecNoun other)
        {
            if (other == null)
            {
                return false;
            }

            if ((this.Name == other.Name) &&
                (this.Definition == other.Definition) &&
                (this.ProjectName == other.ProjectName))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        #endregion

        #region IComparable<PsSpecNoun> Members

        public int CompareTo(Object other)
        {
            PsSpecNoun otherNoun = other as PsSpecNoun;
            if (otherNoun != null)
                return this.Name.CompareTo(otherNoun.Name);
            else
                return 0;
        }

        #endregion
    }
}